
using System;
using System.Collections.Generic;


namespace Boilen.Primitives.CodeGeneration
{

    partial struct SourceStruct :
        IEquatable<SourceStruct>
    {

        private readonly string _privateBackingFieldForProperty_Value;


        /// <summary>
        /// Initializes a new instance of the <see cref='SourceStruct'/> struct with the specified value.
        /// </summary>
        /// <param name='value'>
        /// Test-description-for-value.
        /// </param>
        public SourceStruct(string value)
        {
            this._privateBackingFieldForProperty_Value = value;

            this.InitializeInstance();
        }

        partial void InitializeInstance();


        /// <summary>
        /// Gets test-description-for-value.
        /// </summary>
        public string Value
        {
            get { return this._privateBackingFieldForProperty_Value; }
        }


        #region IEquatable<SourceStruct> Members

        /// <summary>
        /// Indicates whether the current object is equal to another object of the same type.
        /// </summary>
        /// <returns>
        /// <see langword='true'/> if the current object is equal to the <paramref name="other" /> parameter; otherwise, <see langword='false'/>.
        /// </returns>
        /// <param name='other'>
        /// An object to compare with this object.
        /// </param>
        public bool Equals(SourceStruct other)
        {
            return EqualityComparer<string>.Default.Equals(this.Value, other.Value)
                && this.EqualsCore(other);
        }

        /// <summary>
        /// Determines whether two specified <see cref='SourceStruct'/> objects have the same value.
        /// </summary>
        /// <returns>
        /// <see langword='true'/> if the value of <paramref name='left'/> is the same as the value of <paramref name='right'/>; otherwise, <see langword='false'/>.
        /// </returns>
        /// <param name='left'>
        /// A <see cref='SourceStruct'/> object.
        /// </param>
        /// <param name='right'>
        /// A <see cref='SourceStruct'/> object.
        /// </param>
        public static bool operator ==(SourceStruct left, SourceStruct right)
        {
            return EqualityComparer<SourceStruct>.Default.Equals(left, right);
        }

        /// <summary>
        /// Determines whether two specified <see cref='SourceStruct'/> objects have different values.
        /// </summary>
        /// <returns>
        /// <see langword='true'/> if the value of <paramref name='left'/> is the same as the value of <paramref name='right'/>; otherwise, <see langword='false'/>.
        /// </returns>
        /// <param name='left'>
        /// A <see cref='SourceStruct'/> object.
        /// </param>
        /// <param name='right'>
        /// A <see cref='SourceStruct'/> object.
        /// </param>
        public static bool operator !=(SourceStruct left, SourceStruct right)
        {
            return !EqualityComparer<SourceStruct>.Default.Equals(left, right);
        }

        /// <summary>
        /// Determines whether the specified <see cref="System.Object" /> is equal to the current <see cref="System.Object" />.
        /// </summary>
        /// <returns>
        /// <see langword='true'/> if the specified <see cref="System.Object" /> is equal to the current <see cref="System.Object" />; otherwise, <see langword='false'/>.
        /// </returns>
        /// <param name='obj'>
        /// The <see cref="System.Object" /> to compare with the current <see cref="System.Object" />.
        /// </param>
        public override bool Equals(object obj)
        {
            return obj is SourceStruct
                && this.Equals((SourceStruct)obj);
        }

        /// <summary>
        /// Serves as a hash function for a particular type.
        /// </summary>
        /// <returns>
        /// A hash code for the current <see cref="System.Object" />.
        /// </returns>
        public override int GetHashCode()
        {
            int hash = EqualityComparer<string>.Default.GetHashCode(this.Value);
            hash = ((hash << 5) + hash) ^ this.GetHashCodeCore();
            return hash;
        }

        #endregion

    }

}
